#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time: 2022/12/22 11:11
# @Author: scg
# @Email: xxx@gmail.com
# @File：customer_add_page.py
from selenium.webdriver.common.by import By
from pages.base_page import BasePage


class CustomerAddPage(BasePage):
    url = '/crm/index.php?m=customer&a=add'

    name_locator = (By.ID, 'name')
    note_locator = (By.NAME, 'con_description')  # 备注
    save_btn_locator = (By.CSS_SELECTOR, '#form1 > table > tfoot > tr > td > input:nth-child(1)')

    def input_name(self, name):
        self.driver.find_element(*self.name_locator).send_keys(name)

    def input_note(self, msg):
        self.driver.find_element(*self.note_locator).send_keys(msg)

    def click_save_btn(self):
        self.driver.find_element(*self.save_btn_locator).click()
